package lab6.systemCustom;

import java.util.ArrayList;
import java.util.StringTokenizer;

@SuppressWarnings("unchecked")
public class Student {

	protected String sSID;

	protected String sName;

	protected String sSpecializare;

	protected ArrayList vCompleted;

	protected ArrayList vRegistered;

	protected int iBalance;

	public Student(String sInput) {

		StringTokenizer objTokenizer = new StringTokenizer(sInput);

		this.sSID = objTokenizer.nextToken();
		this.sName = objTokenizer.nextToken();
		this.sName = this.sName + " " + objTokenizer.nextToken();
		this.sSpecializare = objTokenizer.nextToken();
		this.iBalance = Integer.parseInt(objTokenizer.nextToken());

		this.vCompleted = new ArrayList();
		while (objTokenizer.hasMoreTokens()) {
			this.vCompleted.add(objTokenizer.nextToken());
		}

		this.vRegistered = new ArrayList();
	}

	public boolean match(String sSID) {
		return this.sSID.equals(sSID);
	}

	public String getName() {
		return this.sName;
	}

	public ArrayList getRegisteredCourses() {
		return this.vRegistered;
	}

	public ArrayList getCompletedCourses() {
		return this.vCompleted;
	}

	public void registerCourse(Course objCourse) {
		this.vRegistered.add(objCourse);
	}

	public String toString() {
		String sReturn = this.sSID + " " + this.sName + " " + this.sSpecializare + " " + this.iBalance;

		for (int i = 0; i < this.vCompleted.size(); i++) {
			sReturn = sReturn + " " + this.vCompleted.get(i).toString();
		}

		return sReturn;
	}

}